﻿using System;
using System.Web.Security;
using br.com.SistemaChamados.Constants;
using br.com.SistemaChamados.Controller.Common;
using br.com.SistemaChamados.Model.Common;

namespace SysCall_FINAL.Pages.Master
{
    public partial class MainUser : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            User loggedUser = new User();
            UserController userController = new UserController();
            loggedUser.Id = Convert.ToInt32(Session[UserConstants.SESSION_USER_LOGGED_IN]);
            loggedUser = userController.GetUser(loggedUser);
            lblUser.Text = loggedUser.Name;
        }

        protected void btnLogOut_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            FormsAuthentication.SignOut();
            Response.Redirect("../Login/Login.aspx");
        }
    }
}